//javamaps
//Copyright (c) 2010 Bebeselea Elena
package Core;
import java.io.*;

public class Marker implements Serializable {
    private ObjectId id_;
    private Coordinates coordinates_;
    private String name_;
    private ObjectId nearestNode_;
    private MarkerPriority priority_;
    
    /*
     * Constructori.
     */
    public Marker(ObjectId id, Coordinates coordinates) {
        id_ = id;
        coordinates_ = coordinates;
    }

    public Marker(ObjectId id, Coordinates coordinates, String name) {
        this(id, coordinates);
        name_ = name;
    }

    public Marker(ObjectId id, Coordinates coordinates, String name,
                  ObjectId nearestNode, MarkerPriority priority){
        this(id, coordinates, name);
        nearestNode_ = nearestNode;
        priority_ = priority;
    }
    
    /*
     * Metode publice.
     */
    public ObjectId ID(){ return id_; }
    public void SetID(ObjectId ID){ id_ = ID; }
    
    public Coordinates Coordinates(){ return coordinates_; }
    public void SetCoordinates(Coordinates coordinates){
        coordinates_ =  coordinates; 
    }
    
    public String Name(){ return name_; }
    public void SetName(String name){ name_ = name; }
    
    public ObjectId NearestNode(){ return nearestNode_; }
    public void SetNearestNode(ObjectId nearestNode){ nearestNode_ = nearestNode; }
    
    public MarkerPriority Priority(){ return priority_; }
    public void SetMarkerPriority(MarkerPriority priority){ priority_ = priority; }

     @Override
     public boolean equals(Object obj) {
        if(obj == null) return false;
        if(this == obj) return true;
        if(this.getClass() != obj.getClass()) return false;

        Marker marker = (Marker)obj;
        return ( marker.id_ == id_ );
    }

     @Override
     public int hashCode() { return id_.Id();}
}
